<template>
  <div>
    <el-form ref="form" :model="form" :label-width="labelWidth">
      <el-row
        v-for="(items, index) in userTopList"
        :key="index"
        :gutter="20"
        type="flex"
      >
        <el-col v-for="(item, index) in items" :span="item.span" :key="index">
          <el-form-item
            :label-width="item.type === 'Button' ? '0' : labelWidth"
            :label="item.label && item.label + '：'"
            :prop="item.prop"
          >
            <el-input
              v-if="item.type === 'Input'"
              :placeholder="item.placeholder"
            ></el-input>
            <el-button
              v-if="item.type === 'Button'"
              :type="item.colorType"
              :icon="item.icon"
              :plain="item.isShow"
              >{{ item.title }}</el-button
            >
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>

<script>
export default {
  props: {
    userTopList: {
      type: Array,
      default: () => [],
    },
    labelWidth: {
      type: String,
    },
  },
  data() {
    return {
      form: {},
    };
  },
};
</script>

<style lang="less" scoped>
.el-col-24 {
  width: auto;
}
.el-col-2 {
  width: auto;
}
</style>
